package gwtgaetools.client;

import gwtgaetools.client.ItemManager;

public abstract class ManagerRST<In1, In2, Out> extends ItemManager<Out> {

	public ItemManager<In1> in1 = new ItemManager<In1>() {
		
		@Override public void observe(ItemManager<In1> i1) {
			super.observe(i1);
			updateOutput();
		}
		
	};
	
	public ItemManager<In2> in2 = new ItemManager<In2>() {
		
		@Override public void observe(ItemManager<In2> i2) {
			super.observe(i2);
			updateOutput();
		}
		
	};
	
	public ManagerRST() {}
	
	public ManagerRST(ItemManager<In1> i1, ItemManager<In2> i2) {
		setIn1(i1);
		setIn2(i2);
	}

	public void setIn1(ItemManager<In1> i1) {	in1.setObservedManager(i1);		}
	public void setIn2(ItemManager<In2> i2) {	in2.setObservedManager(i2);		}
	public void updateOutput() 				{	setItem(getOutput());			}
	
	public abstract Out getOutput();

	
}
